#pragma once

#include <string>
#include <list>
using namespace std;

#include "Point.h"

// color constants
#define BLACK 0
#define WHITE 255

#define COLORS 256

typedef struct stChainCode
{
	static unsigned int GetX(unsigned int x, unsigned char dir);
	static unsigned int GetY(unsigned int y, unsigned char dir);

	// staring of chain code
	Point p;
	// string of codes
	list<unsigned char> chain;

	// color
	unsigned char c;

	static void Extract(unsigned int dwHeight, 
					unsigned int dwWidth,
					unsigned int w,
					BYTE* lpSrc,
					list<struct stChainCode>& l);

	struct stChainCode& Derivate();
	bool ExtractFromFile(char* fileName);
	bool ToFile(char* fileName);

} ChainCode;

